﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DAL;
using System.Data.SqlClient;
public partial class pages_WorkingReport_SearchWoringReport : System.Web.UI.Page
{
    EOaWorkingReport oaWork = new EOaWorkingReport();
    /// <summary>
    /// 考勤查询 界面初始化
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //把时间搜索条件默认值都置为当天
            this.txtBeginDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd");
            this.txtEndDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd");
        }
       
    }
    /// <summary>
    /// 考勤查询 点击查询按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSearch_Click(object sender, EventArgs e)
    {

        //获取页面中的查询条件
        string sEmpCode = this.hidEmpCode.Value;//员工编号或组织机构编号        
        string sBeginDate = Request.Form[txtBeginDate.UniqueID].Trim();//开始时间
        string sEndDate = Request.Form[txtEndDate.UniqueID].Trim();//结束时间
        //根据查询条件获取数据
        oaWork.SearchWorkingReprot(ref sEmpCode, sBeginDate, sEndDate, DataList1);
            
        Console.WriteLine(txtEmpName.Text);
    }
    /// <summary>
    /// 考勤查询 绑定工作日志明细信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
    {   
            ;
            GridView oGridView = (GridView)e.Item.FindControl("GridView1");
            if (oGridView != null)
            {
                //绑定工作日志明细
                oaWork.BindWoringReportList(ref oGridView, ((HiddenField)e.Item.FindControl("id")).Value);  

            }
        
    }

}
